home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / AIAT / Headers / Accessor / InVecAccessor.h < prev    next >
Encoding:
Text File  |  1998-04-16  |  2.2 KB  |  92 lines  |  [TEXT/CWIE]

  1. // InVecAccessor.h
  2. // accellerates searches on InVec indices
  3. //    Copyright:    © 1994-1996-1997-1998 by Apple Computer, Inc., all rights reserved.
  4.  
  5. #pragma once
  6. #ifndef InVecAccessor_h
  7. #define InVecAccessor_h
  8.  
  9. #pragma import on
  10.  
  11. #if PRAGMA_STRUCT_ALIGN
  12.     #pragma options align=power
  13. #endif
  14.  
  15. #include "VectorAccessor.h"
  16. #include "InvertedAccessor.h"
  17. #include "InVecIndex.h"
  18.  
  19. #pragma IA_BEGIN_EXPORTS
  20.  
  21. class IAQuery;
  22.  
  23. const uint32 InVecAccessorType = 'I&V0';
  24.  
  25. class InVecAccessor : public InvertedAccessor,  public VectorAccessor {
  26. public:
  27.         InVecAccessor(InVecIndex** indices, uint32 indexCount, uint32 type = InVecAccessorType);
  28.         ~InVecAccessor();
  29.         
  30.     uint32        RankedSearch(byte*                     textQuery,     uint32     textQueryLen,
  31.                              RankedQueryDoc*         docQuery,     uint32     docQueryLen,
  32.                              RankedHit**            results,    uint32    resultLen,
  33.                              uint32                    matchingTermsLen,
  34.                              RankedProgressFn*        progressFn,
  35.                              clock_t                progressFreq,
  36.                              void*                    appData);
  37.                              
  38.     uint32        RankedSearch(IADocText*             textQuery,
  39.                              RankedQueryDoc*         docQuery,     uint32     docQueryLen,
  40.                              RankedHit**            results,    uint32    resultLen,
  41.                              uint32                    matchingTermsLen,
  42.                              RankedProgressFn*        progressFn,
  43.                              clock_t                progressFreq,
  44.                              void*                    appData);
  45.  
  46. protected:
  47.     void        Initializing();
  48.     void        CacheTermStats(TermInfo** infos);
  49.  
  50.     IABlockSize    InitsSize();
  51.     void        StoringInits(IAOutputBlock* output);
  52.     void        RestoringInits(IAInputBlock* input);
  53.     
  54.     void        UpdatingInits(IAInputBlock* input);
  55.     void         ExtendingInits();
  56.  
  57.     void        TrimQueryVector(TWVector* queryVector, byte* maxWeights);
  58.     byte**         GetTermMaxWeights() const;
  59.     float*        GetMaxWeightDecoder() const;
  60.     float        GetMaxWeightEncodingFactor() const;
  61.     void        UpdateCacheTermStats(TermInfo** infos);
  62.  
  63. private:
  64.     byte**        termMaxWeights;
  65.     float*        maxWeightDecoder;
  66.     float        maxWeightEncodingFactor;
  67.     
  68.     void        MakeMaxWeightCodec();
  69.  
  70. };
  71.  
  72. inline     byte**     InVecAccessor::GetTermMaxWeights() const
  73. {
  74.     return termMaxWeights;
  75. }
  76. inline     float*    InVecAccessor::GetMaxWeightDecoder() const
  77. {
  78.     return maxWeightDecoder;
  79. }
  80. inline    float    InVecAccessor::GetMaxWeightEncodingFactor() const
  81. {
  82.     return maxWeightEncodingFactor;
  83. }
  84.  
  85. #pragma IA_END_EXPORTS
  86.  
  87. #if PRAGMA_STRUCT_ALIGN
  88.     #pragma options align=reset
  89. #endif
  90.  
  91. #pragma import reset
  92. #endif